let mysql = require('mysql');

let pool = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: 'wu123123',
    port: '3306',
    database: 'quxue',
    multipleStatements: true
})

module.exports = {
    sql(option) {
        pool.query(option.sql, (err, res) => {
            if (err) {
                option.error({
                    code: 500,
                    msg: '数据库的连接错误'
                })
                return
            }
            option.success(res)
        })
    }
}